/**
 * 动态路由和静态路由合并
 */

import { constantRoutes } from '@/router'

export default {
  namespaced: true, // 开启命名空间
  state: () => {
    return {
      routes: constantRoutes // 默认静态路由
    }
  },
  mutations: {
    // 设置动态路由方法
    setRoutes(state, asyncRoutes) {
      state.routes = [...constantRoutes, ...asyncRoutes]
    }
  }
}
